import { ApiCall } from "tsrpc";
import MarketManage from "../../core/manage/MarketManage";
import { ReqBuy, ResBuy } from "../../shared/api_client/market/PtlBuy";


export default async function (call: ApiCall<ReqBuy, ResBuy>) {
    let id = call.req.id;
    let user = call.req._player;
    let msg =  MarketManage.buy(id,user,call.req.count);
    if(msg){
        call.error(msg);
        return;
    }
    call.succ({});
}
